﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using WPFWorkbookDesigner.Properties;

namespace WPFWorkbookDesigner.Addons
{
    public static class MesBox
    {
        private static string FormatMes(Exception ex)
        {
            return $"{ex.TargetSite}{'\n'}{ex.Source}{'\n'}{ex.Message}{'\n'}{ex.GetType()}{'\n'}{ex.StackTrace}";
        }
        public static MessageBoxResult Error(Exception ex, MessageBoxButton button = MessageBoxButton.OK)
        {
            return MessageBox.Show(FormatMes(ex), Resources.Title, button, MessageBoxImage.Error);
        }
        public static MessageBoxResult Error(string ex, MessageBoxButton button = MessageBoxButton.OK)
        {
            return MessageBox.Show(ex, Resources.Title, button, MessageBoxImage.Error);
        }

        public static MessageBoxResult Info(Exception ex, MessageBoxButton button = MessageBoxButton.OK)
        {
            return MessageBox.Show(FormatMes(ex), Resources.Title, button, MessageBoxImage.Information);
        }
        public static MessageBoxResult Info(string ex, MessageBoxButton button = MessageBoxButton.OK)
        {
            return MessageBox.Show(ex, Resources.Title, button, MessageBoxImage.Information);
        }

        public static MessageBoxResult Warning(Exception ex, MessageBoxButton button = MessageBoxButton.OK)
        {
            return MessageBox.Show(FormatMes(ex), Resources.Title, button, MessageBoxImage.Warning);
        }
        public static MessageBoxResult Warning(string ex, MessageBoxButton button = MessageBoxButton.OK)
        {
            return MessageBox.Show(ex, Resources.Title, button, MessageBoxImage.Warning);
        }
        public static MessageBoxResult Question(string str, MessageBoxButton button = MessageBoxButton.YesNo)
        {
            return MessageBox.Show(str, Resources.Title, button, MessageBoxImage.Information);
        }
    }
}
